package dao

import (
	"github.com/jinzhu/gorm"
	"go-admin/internal/model"
)

// 根据角色删除绑定角色的菜单
func (d *Dao) DeleteRoleMenuS(db *gorm.DB, roleId string) error {
	roleMenu := model.RoleMenu{}
	return roleMenu.Delete(db, roleId)
}

// 根据角色创建绑定角色的菜单
func (d *Dao) CreateRoleMenu(db *gorm.DB, roleId string, menuIds []string) error {
	roleMenu := model.RoleMenu{}
	return roleMenu.Create(db, roleId, menuIds)
}

func (d *Dao) GetMenuIdsByRoleId(roleId string) ([]*model.RoleMenu, error) {
	roleMenu := model.RoleMenu{}
	return roleMenu.GetMenuIdsByRoleId(d.Engine, roleId)
}
